﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Luxury_car_sales_system
{
    public partial class Customer_Entry : Form
    {
        public Customer_Entry()
        {
            InitializeComponent();
        }

        private void Customer_Entry_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string sex = "";
            if (radioButton1.Checked == true)
            {
                sex = radioButton1.Text;
            }
            else if (radioButton2.Checked == true)
            {
                sex = radioButton2.Text;
            }
            string sql = string.Format("insert into Customer values('{0}','{1}','{2}','{3}','{4}','{5}')",textBox1.Text,textBox2.Text,sex,textBox3.Text,textBox5.Text,textBox4.Text);
            bool a = DBHelper.ExcuteNonQuery(sql);
            if (a == true)
            {
                MessageBox.Show("添加成功！");
            }
            else if(a==false)
            {
                MessageBox.Show("添加失败");
            }
        }

        private void 客户信息修改ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Customer_maintain CM = new Customer_maintain();
            CM.Show();
        }

        private void 客户信息查询ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Customer_inquiries CI = new Customer_inquiries();
            CI.Show();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
